<?if(isset($print)):?>
<style>
	table.table{
		width:100%;
		border:1px solid #000;
		border-collapse:collapse
	}
	
	table.table tr td{
		border:1px solid #000;
	}
	
</style>

<table style="width:100%;">
	<tr>
		<td style="text-align:center;"><?=$school_name;?></td>
	</tr>
	<tr>
		<td style="text-align:center;">SUMMARY OF ENROLLMENT</td>
	</tr>
	<tr>
		<td style="text-align:center;">SCHOOL YEAR : <?=$school_year;?></td>
	</tr>
</table>
<?endif;?>

<?foreach($count as $key => $levels):?>
	<h5><?=$key;?></h5>
	<table class="table table-bordered table-striped">
		<tr>
			<?foreach($levels as $k => $v):?>
					<td colspan="2" style="text-align:center;"><?=ucwords($k);?></td>
			<?endforeach;?>
		</tr>
		<tr>
			<?foreach($levels as $k => $v):?>
					<td style="text-align:center;font-weight:bold;">M</td>
					<td style="text-align:center;font-weight:bold;">F</td>
			<?endforeach;?>
		</tr>
		<tr>
			<?foreach($levels as $k => $v):?>
					<td style="text-align:center;font-weight:bold;"><?=$v['male'];?></td>
					<td style="text-align:center;font-weight:bold;"><?=$v['female'];?></td>
			<?endforeach;?>
		</tr>
		<tr>
			<?foreach($levels as $k => $v):?>
					<td colspan="2" style="text-align:center;font-weight:bold;"><?=$v['female'] + $v['male'];?></td>
			<?endforeach;?>
		</tr>
	</table>
<?endforeach;?>
<br>
<table class="table table-bordered table-striped">
	<tr>
		<td style="text-align:center;font-weight:bold;">DEPARTMENT</td>
		<td style="text-align:center;font-weight:bold;">MALE</td>
		<td style="text-align:center;font-weight:bold;">FEMALE</td>
		<td style="text-align:center;font-weight:bold;">TOTAL</td>
	</tr>
	<tr>
		<td>PRE SCHOOL</td>
		<td style="text-align:center;"><?=$pre['male'];?></td>
		<td style="text-align:center;"><?=$pre['female'];?></td>
		<td style="text-align:center;"><?=($pre['female'] + $pre['male']);?></td>
		
	</tr>
	<tr>
		<td>LOWER SCHOOL</td>
		<td style="text-align:center;"><?=$low['male'];?></td>
		<td style="text-align:center;"><?=$low['female'];?></td>
		<td style="text-align:center;"><?=($low['female'] + $pre['male']);?></td>
		
	</tr>
	<tr>
		<td>UPPER SCHOOL</td>
		<td style="text-align:center;"><?=$upp['male'];?></td>
		<td style="text-align:center;"><?=$upp['female'];?></td>
		<td style="text-align:center;"><?=($upp['female'] + $upp['male']);?></td>
		
	</tr>
	<tr>
		<td>HIGH SCHOOL</td>
		<td style="text-align:center;"><?=$hs['male'];?></td>
		<td style="text-align:center;"><?=$hs['female'];?></td>
		<td style="text-align:center;"><?=($hs['female'] + $hs['male']);?></td>
		
	</tr>
	<tr>
		<td>TOTAL</td>
		<td style="text-align:center;"><?=($male =$hs['male'] + $upp['male'] + $low['male'] + $pre['male']);?></td>
		<td style="text-align:center;"><?=($female = $hs['female'] + $upp['female'] + $low['female'] + $pre['female']);?></td>
		<td style="text-align:center;"><?=($female + $male);?></td>
	</tr>
</table>